<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('评论列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>文章id：</p>
                                <input type="text" name="articleId"/>
                            </li>
                            <li>
                                <p>楼层：</p>
                                <input type="text" name="parentId"/>
                            </li>
                            <li>
                                <p>发布人：</p>
                                <input type="text" name="fromBy"/>
                            </li>
                            <li>
                                <p>回复人：</p>
                                <input type="text" name="replyBy"/>
                            </li>
                            <li>
                                <p>内容：</p>
                                <input type="text" name="content"/>
                            </li>
                        <!--    <li>
                                <p>评论类型：</p>
                                <select name="commentType" th:with="type=${@dict.getType('')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>-->
                            <li>
                                <p>状态：</p>
                                <input type="text" name="fettle"/>
                            </li>
                            <li>
                                <p>ip：</p>
                                <input type="text" name="ip"/>
                            </li>
                            <li>
                                <p>系统：</p>
                                <input type="text" name="userSystem"/>
                            </li>
                            <li>
                                <p>浏览器：</p>
                                <input type="text" name="userBower"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <div class="btn-group">
                    <button data-toggle="dropdown" class="btn btn-primary dropdown-toggle">批量操作 <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" id="commentFettle" th:with="type=${@dict.getType('cms.comment.fettle')}">
                        <li  th:each="dict : ${type}"  th:data-id="${dict.dictValue}" ><a href="javascript:void(0)" th:text="${dict.dictLabel}"></a></li>

                    </ul>
                </div>
                <a class="btn btn-danger multiple disabled"
                   onclick="$.operate.removeAll()"
                   shiro:hasPermission="cms:comment:remove"> <i
                        class="fa fa-remove"></i> 批量删除
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var addFlag = [[${@permission.hasPermi('cms:comment:add')}]];
        var editFlag = [[${@permission.hasPermi('cms:comment:edit')}]];
        var removeFlag = [[${@permission.hasPermi('cms:comment:remove')}]];
        var prefix = ctx + "cms/comment";

        $(function() {
            var options = {
                url: prefix + "/list",
                removeUrl: prefix + "/deleteCmsCommentByIds",
                exportUrl: prefix + "/export",
                modalName: "评论",
                columns: [{
                        checkbox: true
                },
                    {
                        field : 'commentId',
                        title : '评论id',
                        align: 'left'
                    },
                {
                    field : 'articleId',
                    title : '文章id',
                    align: 'left'
                },
                {
                    field : 'parentId',
                    title : '父Id',
                    align: 'left'
                },
                {
                    field : 'fromBy',
                    title : '发布人',
                    align: 'left'
                },
                {
                    field : 'replyBy',
                    title : '回复的人',
                    align: 'left'
                },
                {
                    field : 'content',
                    title : '内容',
                    align: 'left'
                },
                {
                    field : 'commentType',
                    title : '评论类型',
                    align: 'left'
                },
                {
                    field : 'fettle',
                    title : '状态',
                    align: 'left'
                },
                {
                    field : 'ip',
                    title : 'ip',
                    align: 'left'
                },
                {
                    field : 'userSystem',
                    title : '系统',
                    align: 'left'
                },
                {
                    field : 'userBower',
                    title : '浏览器',
                    align: 'left'
                },
                {
                    field : 'nastyCount',
                    title : '讨厌统计',
                    align: 'left'
                },
                {
                    field : 'likeCount',
                    title : '喜欢统计',
                    align: 'left'
                },

                {
                    title: '操作',
                    align: 'left',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.commentId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
            /*文章顶置下拉框点击事件*/
            $('#commentFettle>li').click(function(e) {
                //获取选中行数据
                var pam={},articlesIds=[],chooseData =$("#bootstrap-table").bootstrapTable('getSelections');
                pam.fettle=$(this).attr("data-id");
                if (chooseData.length>0)
                {$.each(chooseData,function (index,ele) {
                    articlesIds.push(ele.commentId);
                });
                    pam.articleIds=articlesIds.join();
                    $.modal.confirm("确认要修改选中评论的属性吗？", function() {
                        $.operate.post(prefix + "/updateCommentFettle", pam);
                    })
                }
                else{
                    $.modal.alert("请至少选择一项");

                }
            });
        });
    </script>
</body>
</html>